<?php

namespace Alipay\AlipayFund\Response;

use Alipay\Http\Response;

class AlipayFundBatchDetailResponse extends Response
{
    private $msg;

    private $detailList;

    private $batchStatus;

    private $batchTransId;

    private $out_batch_no;

    private $sign;

    public function resolve(): Response
    {
        parent::resolve();

        if (json_decode($this->getBody())) {

            $body = json_decode($this->getBody(), true);
            $this->setBody($body);

            $body = $body['alipay_fund_batch_detail_query_response'] ?? '';

            $this->sign = $body['sign'] ?? '';
            $this->msg = $body['msg'] ?? '';
            $code = $body['code'] ?? '';
            if ($code != '10000') {
                $this->setError($this->msg . ($body['sub_code'] ?? '') . ($body['sub_msg'] ?? ''));
            }
            $this->detailList = $body['acc_detail_list'] ?? [];

            $this->batchStatus = $body['batch_status'] ?? '';

            $this->out_batch_no = $body['out_batch_no'] ?? '';

            $this->batchTransId = $body['batch_trans_id'] ?? '';

        } else {
            $this->setError($this->getBody());
        }
        return $this;
    }

    /**
     * @return mixed
     */
    public function getDetailList()
    {
        return $this->detailList;
    }

    /**
     * @return mixed
     */
    public function getBatchStatus()
    {
        return $this->batchStatus;
    }

    /**
     * @return mixed
     */
    public function getBatchTransId()
    {
        return $this->batchTransId;
    }

    /**
     * @return mixed
     */
    public function getOutBatchNo()
    {
        return $this->out_batch_no;
    }



}